****************************************************************************
***                 The Geography of Citizenship Practice                ***
***               Adam Auerbach and Gabrielle Kruks-Wisner               ***
***                       Stata Code for Urban Data                      ***
****************************************************************************

****************************************************************************
***                   Create Asset Index and Quintiles                   ***
****************************************************************************


destring television motorcycle cell_phone refrigerator gas_chula radio car, replace

gen seven_asset_index = television + motorcycle + cell_phone + refrigerator + gas_chula + radio + car

xtile seven_asset_quint = seven_asset_index, n(5)


****************************************************************************
***             Table 1, Descriptive Statistics, Urban Slums             ***
****************************************************************************


tab bpl_card 

sum seven_asset_index 

destring education, replace
sum education 

tab scheduled_caste 

tab scheduled_tribe 

tab muslim 

tab gender


****************************************************************************
***                         Group Claim-Making                           ***
****************************************************************************


tab group_claim_making

tab personal_group_cm_all

tab personal_group_cm_all if any_patta == "1"

tab personal_group_cm_all if any_patta == "0"

tab personal_group_cm_all if seven_asset_quint == 1

tab personal_group_cm_all if scheduled_caste == "1"

tab personal_group_cm_all if scheduled_tribe == "1"

tab personal_group_cm_all if muslim == "1"

tab personal_group_cm_all if gender == "1"


****************************************************************************
***     Table 2, Expectations of State Responsiveness, Urban Slums       ***
****************************************************************************


tab expect_state_responsiveness

tab expect_state_responsiveness if seven_asset_quint == 1

tab expect_state_responsiveness if education == 0

tab expect_state_responsiveness if scheduled_caste == "1"

tab expect_state_responsiveness if scheduled_tribe == "1"

tab expect_state_responsiveness if muslim == "1"

tab expect_state_responsiveness if gender == "1"


****************************************************************************
***         Difference of Means Tests for Expectations, Urban Slums      ***
****************************************************************************


gen lowest_asset_quint = .
replace lowest_asset_quint = 1 if seven_asset_quint == 1
replace lowest_asset_quint = 0 if seven_asset_quint == 2 | seven_asset_quint == 3| seven_asset_quint == 4 | seven_asset_quint == 5

gen any_patta_binary = .
replace any_patta_binary = 1 if any_patta == "1"
replace any_patta_binary = 0 if any_patta == "0" 

gen edu = education
destring edu, replace
gen no_education = .
replace no_education = 1 if edu == 0
replace no_education = 0 if edu == 1 | edu == 2 | edu == 3 | edu == 4 | edu == 5 | edu == 6 | edu == 7 | edu == 8 | edu == 9 | edu == 10 | edu == 11 | edu == 12 | edu == 13 | edu == 14 | edu == 15 | edu == 16 | edu == 17

gen sc = .
replace sc = 1 if scheduled_caste == "1"
replace sc = 0 if scheduled_caste == "0"

gen st = .
replace st = 1 if scheduled_tribe == "1"
replace st = 0 if scheduled_tribe == "0"

gen muslim_respondent = .
replace muslim_respondent = 1 if muslim == "1"
replace muslim_respondent = 0 if muslim == "0"

gen female = .
replace female = 1 if gender == "1"
replace female = 0 if gender == "0"

gen migrant = .
replace migrant = 1 if born_in_jai_bho_district == "0"
replace migrant = 0 if born_in_jai_bho_district == "1"

gen expect_state_resp_binary = .
replace expect_state_resp_binary = 1 if expect_state_responsiveness == "1"
replace expect_state_resp_binary = 0 if expect_state_responsiveness == "0"

prtest expect_state_resp_binary, by(lowest_asset_quint)

prtest expect_state_resp_binary, by(any_patta_binary)

prtest expect_state_resp_binary, by(no_education)

prtest expect_state_resp_binary, by(sc)

prtest expect_state_resp_binary, by(st)

prtest expect_state_resp_binary, by(muslim_respondent)

prtest expect_state_resp_binary, by(female)

prtest expect_state_resp_binary, by (migrant)

****************************************************************************
***                Expectations, Intersectional Categories               ***
****************************************************************************


tab expect_state_responsiveness if gender == "1" & scheduled_caste == "1"

tab expect_state_responsiveness if gender == "1" & scheduled_tribe == "1"

tab expect_state_responsiveness if gender == "1" & muslim == "1"

tab expect_state_responsiveness if gender == "1" & education == 0


****************************************************************************
***            Table 3, Reported Presence of Slum Leaders                ***
****************************************************************************


tab acknowledge_leader 

tab acknowledge_leader if seven_asset_quint == 1

tab acknowledge_leader if education == 0

tab acknowledge_leader if scheduled_caste == "1"

tab acknowledge_leader if scheduled_tribe == "1"

tab acknowledge_leader if muslim == "1"

tab acknowledge_leader if gender == "1"


***************************************************************************
***      Difference of Means Tests for Acknowledging Slum Leaders       ***
***************************************************************************


gen acknowledge_leader_binary = .
replace acknowledge_leader_binary = 1 if acknowledge_leader == "1"
replace acknowledge_leader_binary = 0 if acknowledge_leader == "0"

prtest acknowledge_leader_binary, by(lowest_asset_quint)

prtest acknowledge_leader_binary, by(any_patta_binary)

prtest acknowledge_leader_binary, by(no_education)

prtest acknowledge_leader_binary, by(sc)

prtest acknowledge_leader_binary, by(st)

prtest acknowledge_leader_binary, by(muslim_respondent)

prtest acknowledge_leader_binary, by(female)

prtest acknowledge_leader_binary, by (migrant)


***************************************************************************
***          Table 4, Informality and Residential Migration             ***
***************************************************************************


tab expect_state_responsiveness

tab expect_state_responsiveness if any_patta == "0"

tab expect_state_responsiveness if born_in_jai_bho_district == "0"

tab acknowledge_leader

tab acknowledge_leader if any_patta == "0"

tab acknowledge_leader if born_in_jai_bho_district == "0"


***************************************************************************
***                     Turning to Slum Leader                          ***
***************************************************************************


tab turned_to_slum_leader_all

tab turned_to_slum_leader_all if seven_asset_quint == 1

tab turned_to_slum_leader_all if education == 0

tab turned_to_slum_leader_all if scheduled_caste == "1"

tab turned_to_slum_leader_all if scheduled_tribe == "1"

tab turned_to_slum_leader_all if muslim == "1"

tab turned_to_slum_leader_all if gender == "1"

tab turned_to_slum_leader_all if any_patta == "0"

tab turned_to_slum_leader_all if born_in_jai_bho_district == "0"


***************************************************************************
***        Difference of Means Tests for Turning to Slum Leader         ***
***************************************************************************


gen turned_slum_leader_binary = .
replace turned_slum_leader_binary = 1 if turned_to_slum_leader_all == "1"
replace turned_slum_leader_binary = 0 if turned_to_slum_leader_all == "0"

prtest turned_slum_leader_binary, by(lowest_asset_quint)

prtest turned_slum_leader_binary, by(any_patta_binary)

prtest turned_slum_leader_binary, by(no_education)

prtest turned_slum_leader_binary, by(sc)

prtest turned_slum_leader_binary, by(st)

prtest turned_slum_leader_binary, by(muslim_respondent)

prtest turned_slum_leader_binary, by(female)

prtest turned_slum_leader_binary, by(migrant)
